<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
</span><span id="line-2"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Utils.Json</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-7"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span>
</span><span id="line-8"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Numeric.html#"><span class="hs-identifier">Numeric</span></a></span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-comment">-- | Simple data type to represent JSON documents.</span><span>
</span><span id="line-11"></span><span class="hs-keyword">data</span><span> </span><span id="JsonDoc"><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-var">JsonDoc</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-12"></span><span>  </span><span id="JSNull"><span class="annot"><a href="GHC.Utils.Json.html#JSNull"><span class="hs-identifier hs-var">JSNull</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span>
</span><span id="line-13"></span><span>  </span><span id="JSBool"><span class="annot"><a href="GHC.Utils.Json.html#JSBool"><span class="hs-identifier hs-var">JSBool</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span>
</span><span id="line-14"></span><span>  </span><span id="JSInt"><span class="annot"><a href="GHC.Utils.Json.html#JSInt"><span class="hs-identifier hs-var">JSInt</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span>
</span><span id="line-15"></span><span>  </span><span id="JSString"><span class="annot"><a href="GHC.Utils.Json.html#JSString"><span class="hs-identifier hs-var">JSString</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span>
</span><span id="line-16"></span><span>  </span><span id="JSArray"><span class="annot"><a href="GHC.Utils.Json.html#JSArray"><span class="hs-identifier hs-var">JSArray</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span>
</span><span id="line-17"></span><span>  </span><span id="JSObject"><span class="annot"><a href="GHC.Utils.Json.html#JSObject"><span class="hs-identifier hs-var">JSObject</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-comment">-- This is simple and slow as it is only used for error reporting</span><span>
</span><span id="line-21"></span><span class="annot"><a href="GHC.Utils.Json.html#renderJSON"><span class="hs-identifier hs-type">renderJSON</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-22"></span><span id="renderJSON"><span class="annot"><span class="annottext">renderJSON :: JsonDoc -&gt; SDoc
</span><a href="GHC.Utils.Json.html#renderJSON"><span class="hs-identifier hs-var hs-var">renderJSON</span></a></span></span><span> </span><span id="local-6989586621680800634"><span class="annot"><span class="annottext">JsonDoc
</span><a href="#local-6989586621680800634"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-23"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">JsonDoc
</span><a href="#local-6989586621680800634"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-24"></span><span>    </span><span class="annot"><span class="annottext">JsonDoc
</span><a href="GHC.Utils.Json.html#JSNull"><span class="hs-identifier hs-var">JSNull</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;null&quot;</span></span><span>
</span><span id="line-25"></span><span>    </span><span class="annot"><a href="GHC.Utils.Json.html#JSBool"><span class="hs-identifier hs-type">JSBool</span></a></span><span> </span><span id="local-6989586621680800632"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680800632"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; SDoc) -&gt; String -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680800632"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;true&quot;</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;false&quot;</span></span><span>
</span><span id="line-26"></span><span>    </span><span class="annot"><a href="GHC.Utils.Json.html#JSInt"><span class="hs-identifier hs-type">JSInt</span></a></span><span>    </span><span id="local-6989586621680800631"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680800631"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680800631"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-27"></span><span>    </span><span class="annot"><a href="GHC.Utils.Json.html#JSString"><span class="hs-identifier hs-type">JSString</span></a></span><span> </span><span id="local-6989586621680800629"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800629"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#doubleQuotes"><span class="hs-identifier hs-var">doubleQuotes</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; SDoc) -&gt; String -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="GHC.Utils.Json.html#escapeJsonString"><span class="hs-identifier hs-var">escapeJsonString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800629"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><a href="GHC.Utils.Json.html#JSArray"><span class="hs-identifier hs-type">JSArray</span></a></span><span> </span><span id="local-6989586621680800626"><span class="annot"><span class="annottext">[JsonDoc]
</span><a href="#local-6989586621680800626"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#brackets"><span class="hs-identifier hs-var">brackets</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(JsonDoc -&gt; SDoc) -&gt; [JsonDoc] -&gt; SDoc
forall {a}. (a -&gt; SDoc) -&gt; [a] -&gt; SDoc
</span><a href="#local-6989586621680800624"><span class="hs-identifier hs-var">pprList</span></a></span><span> </span><span class="annot"><span class="annottext">JsonDoc -&gt; SDoc
</span><a href="GHC.Utils.Json.html#renderJSON"><span class="hs-identifier hs-var">renderJSON</span></a></span><span> </span><span class="annot"><span class="annottext">[JsonDoc]
</span><a href="#local-6989586621680800626"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-29"></span><span>    </span><span class="annot"><a href="GHC.Utils.Json.html#JSObject"><span class="hs-identifier hs-type">JSObject</span></a></span><span> </span><span id="local-6989586621680800623"><span class="annot"><span class="annottext">[(String, JsonDoc)]
</span><a href="#local-6989586621680800623"><span class="hs-identifier hs-var">fs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((String, JsonDoc) -&gt; SDoc) -&gt; [(String, JsonDoc)] -&gt; SDoc
forall {a}. (a -&gt; SDoc) -&gt; [a] -&gt; SDoc
</span><a href="#local-6989586621680800624"><span class="hs-identifier hs-var">pprList</span></a></span><span> </span><span class="annot"><span class="annottext">(String, JsonDoc) -&gt; SDoc
</span><a href="#local-6989586621680800621"><span class="hs-identifier hs-var">renderField</span></a></span><span> </span><span class="annot"><span class="annottext">[(String, JsonDoc)]
</span><a href="#local-6989586621680800623"><span class="hs-identifier hs-var">fs</span></a></span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><a href="#local-6989586621680800621"><span class="hs-identifier hs-type">renderField</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-32"></span><span>    </span><span id="local-6989586621680800621"><span class="annot"><span class="annottext">renderField :: (String, JsonDoc) -&gt; SDoc
</span><a href="#local-6989586621680800621"><span class="hs-identifier hs-var hs-var">renderField</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680800620"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800620"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680800619"><span class="annot"><span class="annottext">JsonDoc
</span><a href="#local-6989586621680800619"><span class="hs-identifier hs-var">j</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#doubleQuotes"><span class="hs-identifier hs-var">doubleQuotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800620"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>  </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">JsonDoc -&gt; SDoc
</span><a href="GHC.Utils.Json.html#renderJSON"><span class="hs-identifier hs-var">renderJSON</span></a></span><span> </span><span class="annot"><span class="annottext">JsonDoc
</span><a href="#local-6989586621680800619"><span class="hs-identifier hs-var">j</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span>    </span><span id="local-6989586621680800624"><span class="annot"><span class="annottext">pprList :: (a -&gt; SDoc) -&gt; [a] -&gt; SDoc
</span><a href="#local-6989586621680800624"><span class="hs-identifier hs-var hs-var">pprList</span></a></span></span><span> </span><span id="local-6989586621680800615"><span class="annot"><span class="annottext">a -&gt; SDoc
</span><a href="#local-6989586621680800615"><span class="hs-identifier hs-var">pp</span></a></span></span><span> </span><span id="local-6989586621680800614"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680800614"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; [SDoc] -&gt; [SDoc]
</span><a href="GHC.Utils.Outputable.html#punctuate"><span class="hs-identifier hs-var">punctuate</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; SDoc) -&gt; [a] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
</span><a href="#local-6989586621680800615"><span class="hs-identifier hs-var">pp</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680800614"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="annot"><a href="GHC.Utils.Json.html#escapeJsonString"><span class="hs-identifier hs-type">escapeJsonString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-37"></span><span id="escapeJsonString"><span class="annot"><span class="annottext">escapeJsonString :: String -&gt; String
</span><a href="GHC.Utils.Json.html#escapeJsonString"><span class="hs-identifier hs-var hs-var">escapeJsonString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; String) -&gt; String -&gt; String
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String
</span><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span>
</span><span id="line-38"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-39"></span><span>    </span><span id="local-6989586621680800609"><span class="annot"><span class="annottext">escapeChar :: Char -&gt; String
</span><a href="#local-6989586621680800609"><span class="hs-identifier hs-var hs-var">escapeChar</span></a></span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\b'</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\b&quot;</span></span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\f'</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\f&quot;</span></span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\n&quot;</span></span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\r'</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\r&quot;</span></span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\t'</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\t&quot;</span></span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'&quot;'</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\\&quot;&quot;</span></span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\\\&quot;</span></span><span>
</span><span id="line-46"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span id="local-6989586621680800601"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680800601"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isControl"><span class="hs-identifier hs-var">isControl</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680800601"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int
forall a. Enum a =&gt; a -&gt; Int
</span><a href="../../base/src/GHC.Enum.html#fromEnum"><span class="hs-identifier hs-var">fromEnum</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680800601"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0x7f</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; String
forall {a}. Enum a =&gt; a -&gt; String
</span><a href="#local-6989586621680800597"><span class="hs-identifier hs-var">uni_esc</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680800601"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-47"></span><span>    </span><span class="annot"><a href="#local-6989586621680800609"><span class="hs-identifier hs-var">escapeChar</span></a></span><span> </span><span id="local-6989586621680800596"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680800596"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680800596"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-48"></span><span>
</span><span id="line-49"></span><span>    </span><span id="local-6989586621680800597"><span class="annot"><span class="annottext">uni_esc :: a -&gt; String
</span><a href="#local-6989586621680800597"><span class="hs-identifier hs-var hs-var">uni_esc</span></a></span></span><span> </span><span id="local-6989586621680800589"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680800589"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\\u&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; String -&gt; String
</span><a href="#local-6989586621680800588"><span class="hs-identifier hs-var">pad</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; String -&gt; String
forall a. (Integral a, Show a) =&gt; a -&gt; String -&gt; String
</span><a href="../../base/src/Numeric.html#showHex"><span class="hs-identifier hs-var">showHex</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Int
forall a. Enum a =&gt; a -&gt; Int
</span><a href="../../base/src/GHC.Enum.html#fromEnum"><span class="hs-identifier hs-var">fromEnum</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680800589"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span>    </span><span id="local-6989586621680800588"><span class="annot"><span class="annottext">pad :: Int -&gt; String -&gt; String
</span><a href="#local-6989586621680800588"><span class="hs-identifier hs-var hs-var">pad</span></a></span></span><span> </span><span id="local-6989586621680800583"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680800583"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680800582"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800582"><span class="hs-identifier hs-var">cs</span></a></span></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680800581"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680800583"><span class="hs-identifier hs-var">n</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Char -&gt; String
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680800583"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680800581"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'0'</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800582"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-52"></span><span>                          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800582"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-53"></span><span>                                   </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680800581"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621680800581"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680800582"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-keyword">class</span><span> </span><span id="ToJson"><span class="annot"><a href="GHC.Utils.Json.html#ToJson"><span class="hs-identifier hs-var">ToJson</span></a></span></span><span> </span><span id="local-6989586621680800576"><span class="annot"><a href="#local-6989586621680800576"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-56"></span><span>  </span><span id="json"><span class="annot"><a href="GHC.Utils.Json.html#json"><span class="hs-identifier hs-type">json</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680800576"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Json.html#JsonDoc"><span class="hs-identifier hs-type">JsonDoc</span></a></span><span>
</span><span id="line-57"></span></pre></body></html>